﻿using System;
using System.Data;
using System.Collections.Generic;
using Model;

namespace IDAL
{
    public interface IPackageProduct
    {
        //在包装区获取腔体最后一条测试结果
        TestInfo GetlastTest(string productSN);
        PIMTestInfo GetlastPIMTest(string productSN);
        void Insert(PackageProductInfo ppi);
        void Update(PackageProductInfo ppi);
        void SetPackaged(string packageProductSN, string packer, DateTime packageTime);
        //检查成品系列号是否重复
        PackageProductInfo GetPackageProductbyPackageProductSN(string packageProductSN);
        PackageProductInfo GetPackageProductbyProductSN(string productSN);
        PackageProductInfo GetAllPackagebyProductSN(string productSN);
        IList<PackageProductInfo> GetPackageTestsbyPIDDT(string productTypeID, DateTime starttime, DateTime stoptime);
        IList<PackageProductInfo> GetPackageTestsbyUIDDT(string userID, DateTime starttime, DateTime stoptime);
        IList<PackageProductInfo> GetPackagedProductsbyPIDDT(string productTypeID, DateTime starttime, DateTime stoptime);
        IList<PackageProductInfo> GetPackagedProductsbyUIDDT(string userID, DateTime starttime, DateTime stoptime);
        IList<PackageProductInfo> GetPackagedProductsbyPIDDT_forPrinter(string productTypeID, int quantity);
        IList<PackageProductInfo> GetPackageTestsbyDT(DateTime starttime, DateTime stoptime);
        IList<PackageProductInfo> GetPackagedProductsbyDT(DateTime starttime, DateTime stoptime);
        int GetQbyCurrentDay();
        string IsUnionProductSN(string productSN);
        string Isvalid3bk(string ProductTypeName,string SN3BK);
        bool IsvalidPID(string productSN, string productTypeID);
        string IsvalidMatchingSN(string packageProductSN, string ProductTypeName);
        string IsvalidMatchingSN_SN3BK(string packageProductSN);
        string GetProductTypeID(string ProductSN);
        IList<Time_QInfo> GetPackagedQbyAllPIDDT(DateTime starttime, DateTime stoptime);
        
        int GetCountforPrint(string productTypeID);
        string[] GetPackageProductSNsforPrint(string sN3BK, int amount);
        bool SetPackageProductSNsPrinted(string sN3BK, int amount);

        void AutoUnionforPackageProductSN(PackageProductInfo ppi);
        bool AutoBatchUnionforPackageProductSNs(PackageProductInfo ppi, DataTable dt);

        //七大工序与有源工序管控相关
        bool Package_HasValidSevenStep(string productSN, string productTypeID);
        bool Package_HasValidRFSourceStep(string productSN, string productTypeID);
        bool IsValid_NineStep_DataCheck(string productSN, out string message);
    }
}
